﻿using System;
using System.Windows.Forms;

namespace RPG1
{
    public partial class FormMain : Form
    {
        Hero hero1;
        Monster monster1;
        Monster monster2;
        Monster monster;
        public FormMain()
        {
            InitializeComponent();
        }
        private void FormMain_Load(object sender, EventArgs e)
        {
            hero1 = new Hero("hero1", 150, 150, 20, picBoxHero1,
                labelBottomHero1, labelTopHero1);
            monster1 = new Monster("monster1", 100, 100, 15,
                pictureBoxMonster1, labelBottomMonster1, labelTopMonster1);
            monster2 = new Monster("monster2", 200, 200, 10,
                pictureBoxMonster2, labelBottomMonster2, labelTopMonster2);
            monster = monster1;
        }

        private void picBoxHero1_Click(object sender, EventArgs e)
        {
            hero1.move(monster);
            monster.bloodLoss(hero1.Damage);
            if (monster.CurrentLife <= 0) {
                monster.died();
            }
            if (monster1.CurrentLife > 0)
                monster = monster1;
            else if (monster2.CurrentLife > 0)
                monster = monster2;
            else {
                MessageBox.Show("You Win!");
                return;
            }
            monster.move(hero1);
            hero1.bloodLoss(monster.Damage);
            if (hero1.CurrentLife <= 0) {
                MessageBox.Show("You Loss!");
            }
        }
    }
}
